#ifndef IMPLOT_MY_LINESPLOT_H
#define IMPLOT_MY_LINESPLOT_H

#include "imgui.h"
#include "imgui_manager.h"
#include <deque>
#include <functional>
#include <map>
#include <string>

class MyLinesPlot : public Control
{
  public:
    MyLinesPlot(std::string _name, size_t max_visible_points_);
    ~MyLinesPlot();

    void setUpdateDataFunc(std::function<void()> _func);
    void addOrUpdateSeries(const std::string &name, const ImVec2 &point);
    void addOrUpdateSeries(const std::string &name, float y);

    void Show() override;
    void Clear();

  private:
    std::function<void()> updateData;

    std::map<std::string, std::deque<ImVec2>> series_data;
    size_t max_visible_points;
};

#endif // IMPLOT_MY_LINESPLOT_H